<%@ page import="entity.User" %>
<%@ page import="entity.Plate" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="Impl.adminDaoImpl" %>
<%@ page import="entity.Admin" %>
<%@ page import="entity.page.ListPage" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>用户首页</title>
    <!-- Bootstrap -->
</head>

<script type="text/javascript">

    $(function () {
        $.get("/showBlockAjax", {},function (data, status) {
            // console.log(data);
            $('.module').html(data);
        })
    })
</script>
<body>
<%--<div class="top-bar" style="height: 50px;width: 100%;background-color:#242729;font-size: 23px;color: white;padding-top: 5px">--%>
<%--    <span style="margin-left: 20px;">论坛首页</span>--%>
<%--</div>--%>
<%@include file="header.jsp"%>
<%request.setCharacterEncoding("utf-8");%>
<%@include file="user_menubar.jsp"%>
<div class="content-wrapper">
    <div class="main">
        <% String sname= (String) request.getAttribute("sname");
            sname=sname.replace("'","");
        %>
        <div class="title">
            <h2><span><img src="img/comments-icon.png" style="width: 25px; height: 20px"></span><%=sname%></h2>
        </div>
        <%
            ArrayList<ListPage> listPages = (ArrayList<ListPage>) request.getAttribute("listPage");
        %>
        <table cellspacing="0" cellpadding="0" width="100%">

            <tr class="tr2">
                <td>&nbsp;</td>
                <td style="width: 80%" align="center">文章</td>
                <td style="width: 10%" align="center">作者</td>
                <td style="width: 10%" align="center">回复</td>
            </tr>

            <%for (int i = 0; i < listPages.size(); i++){

            %>

            <tr class="tr3">
                <td><img src="static/img/head/1.gif" border=0></td>
                <td style="font-size: 15px">
                    <a href="showarticle.jhtml?tid=<%=listPages.get(i).getTid()%>&author=<%=listPages.get(i).getAuthor()%>&sid=<%=request.getAttribute("sid")%>&sname=<%=sname%>">
                        <%=listPages.get(i).getTitle()%></a>
                </td>
                <td align="center"><%=listPages.get(i).getAuthor()%></td>
                <td align="center"><%=listPages.get(i).getReplycount()%></td>
        </tr>
        <%}%>

        </table>
        <span>共有<%=request.getAttribute("allpage") %>页</span>
        <span style="margin-left:150px">第<%=request.getAttribute("pageNow")%>页</span>
        <div style="margin-left: 250px; margin-top: 20px" id="count_page">
            &nbsp;&nbsp;
        <a href="show.jhtml?sid=<%=request.getAttribute("sid")%>&pageNow=1&sname=<%=sname%>">首页</a>
        <%if((int)request.getAttribute("pageNow")>1){ %>
        <a href="show.jhtml?sid=<%=request.getAttribute("sid")%>&pageNow=<%=(int)request.getAttribute("pageNow")-1%>&sname=<%=sname%>">上一页</a>
        <%
            }
        %>

        <%
            if ((int) request.getAttribute("pageNow") < (int) request.getAttribute("allpage")) {
        %>

        <a href="show.jhtml?sid=<%=request.getAttribute("sid")%>&pageNow=<%=(int)request.getAttribute("pageNow")+1%>&sname=<%=sname%>">下一页</a>

        <%} %>

        <a href="show.jhtml?sid=<%=request.getAttribute("sid")%>&pageNow=<%=(int)request.getAttribute("allpage")%>&sname=<%=sname%>">末页</a>

    </div>
    </div>
</div>
</div>

<%@include file="footer.jsp"%>
</body>
</html>